using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace Mundo_3D
{
    class Manejador_Camaras : DrawableGameComponent
    {
        List<Camara_Basica> Camaras = new List<Camara_Basica>();
        int tipo=0;
        Vector3 pos;

        public Manejador_Camaras(Game game): base(game)
        {
            Camaras.Add(new Camara_Libre(game, new Vector3(0, 10.0f, -100.0f), Vector3.Zero, Vector3.Up)); //Camara tipo 0
            Camaras.Add(new Camara_Fija(game, new Vector3(100.0f, 10.0f, 0), Vector3.Zero, Vector3.Up)); //Camara tipo 1
            Camaras.Add(new Camara_Fija(game, new Vector3(-100.0f, 10.0f, 0), Vector3.Zero, Vector3.Up)); //Camara tipo 2
        }

        public override void Initialize()
        {
            base.Initialize();
        }

        public void addCamera(Camara_Basica cam){
            Camaras.Add(cam);
        }

        protected override void LoadContent()
        {
            base.LoadContent();
        }

        public override void Draw(GameTime gameTime)
        {
        }

        public override void Update(GameTime gameTime)
        {
            KeyboardState keyboardState = Keyboard.GetState();
            if (keyboardState.IsKeyDown(Keys.M))
                tipo=0;
            if (keyboardState.IsKeyDown(Keys.N))
                tipo=1;
            if (keyboardState.IsKeyDown(Keys.B))
                tipo = 2;
            if (keyboardState.IsKeyDown(Keys.V))
                tipo = 3;


            foreach (Camara_Basica cm in Camaras)
                cm.Update(gameTime,tipo,pos);

            base.Update(gameTime);
        }

        public Camara_Basica getCamara()
        {
            return Camaras.ElementAt(tipo);
        }

        public void setPos(Vector3 posi)
        {
            pos = posi;
        }
    }

}